import 'package:flutter/material.dart';

class FFMouseRegion extends StatefulWidget {
  Widget Function(bool hover) builder;

  FFMouseRegion({
    super.key,
    required this.builder,
  });

  @override
  State<FFMouseRegion> createState() => _FFMouseRegionState();
}

class _FFMouseRegionState extends State<FFMouseRegion> {
  bool isHover = false;

  @override
  Widget build(BuildContext context) {
    return MouseRegion(
      onEnter: (e) {
        setState(() {
          isHover = true;
        });
      },
      onExit: (e) {
        setState(() {
          isHover = false;
        });
      },
      child: widget.builder(isHover),
    );
  }
}
